<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!doctype html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>LoveTemperature</title>
		<meta name="author" content="ningzero"/>

		<!-- CSS -->
		<link rel="stylesheet" href="../css/editGood.css">
		<link rel="stylesheet" href="../css/jquery-ui.min.css">
		<!-- end CSS-->

	</head>

	<body>

		<div id="container">
			<header class="header">
				<div id="login_cart_bar">
					<div id="loginRegisterDiv">
						您好，<s:property value="#session.user.name" />
						<a class="pinkAnchor" href="http://localhost:8080/lovetemperature/sale/logout">退出登录</a>
					</div>
					<div id="cartAccountDiv">
						<a class="pinkAnchor" onclick='javascript:window.location="http://localhost:8080/lovetemperature/shop/editStaff"'>我的页面</a>
					</div>
				</div>
				<div id="logo_bar">
					<img src="../img/logo.gif"/>
					<img id="logo_text" src="../img/logo2.png"/>
				</div>
				<div id="nav_bar">
					<ul>
						<li class="nav_padding_left"></li>
						<li class='shouye' >
							<a href="http://localhost:8080/lovetemperature/shop/showOrders">订单管理</a>
						</li>
						<li class='dangao' >
							<a href="http://localhost:8080/lovetemperature/shop/showGood">产品管理</a>
						</li>
					</ul>
				</div>
			</header>
			<div id="mainContent" class="mainContent">
				<h4>添加产品计划</h4>
				<div id="content">
					<form id="uploadFileForm" action="http://localhost:8080/lovetemperature/shop/uploadFile" method="post" enctype="multipart/form-data" target="uploadTarget">
					<div id="goodImgDiv" >
						<div class="file-box">
						 <input type='button' class='btn' value='上传图片' />
						 <input type="file" name="upload" class="file" id="fileField" size="28" onchange="uploadFile()" />
						 </div>
					</div>
					</form>
					<div id="goodInfoDiv">
					<form action="http://localhost:8080/lovetemperature/shop/submitGood" method="post" id='form' >
						<iframe id="uploadTarget"></iframe>
						<p>产品名称：　<input type="text" value='<s:property value="stock.goodSet.good.name"/>' name="stock.goodSet.good.name"/></p>
						<p>产品类别：<s:select list="candidateCategories" name="stock.goodSet.good.category" /></p>
						<p>　　单价：￥<input type="text" name="stock.goodSet.good.price" value='<s:property value="stock.goodSet.good.price"/>'/></p>
						<p>计划产量：　<input type="text" value='<s:property value="stock.goodSet.count"/>' name='stock.goodSet.count'/>件</p>
						<p>上架日期：　<input name="listDate" type="text" id="listDate" onkeypress="javascript:return false" value='请选择'/></p>
						<s:select list="candidateShops" listKey="shopId" listValue="name" name="shopId" label="所属店面"/>
						<input name="stockId" type="hidden" value="<s:property value="stock.stockId"/>" />
						<input id="img" name="stock.goodSet.good.image" type="hidden" value="" />
					</form>
					</div>
					<div id="controlDiv">
						<s:if test="%{newAdd!=true}"><span class="normalBtn" onclick="delect(<s:property value="stock.stockId"/>)">删除该计划</span></s:if>
						<span class="normalBtn" onclick="javascript:history.back(-1)">取消</span>
						<span class="normalBtn" onclick="submit()">确定</span>
					</div>
				</div>
			</div>
			
		</div>
		<!--! end of #container -->
		
		<footer id="footer">
			<img src="../img/tmp/tmpfooter.png" />
		</footer>

		<!-- scripts -->
		<script type="text/javascript" src="../js/libs/jquery-1.9.1.min.js" ></script>
		<script type="text/javascript" src="../js/libs/jquery-ui.min.js" ></script>
		<script type="text/javascript" src="../js/libs/jquery.ui.datepicker.js" ></script>
		<script type="text/javascript" src="../js/libs/jquery.ui.datepicker-zh-CN.js" ></script>
		<script type="text/javascript" src="../js/index.js" ></script>
		<script>
			$(function(){
				$("#listDate").datepicker({ minDate: 1, maxDate: "7" });
			});
			function submit(){
				var date = $("#listDate").datepicker('getDate');
				$('#listDate').val(date);
				 var url =  $("#uploadTarget").contents().find("#imgUrlInput").val();
				$('#img').val(url);
				$('#form').submit();
			}
			function uploadFile(){
				$('#uploadFileForm').submit();
			}
			function delect(stockId){
				window.location="http://localhost:8080/lovetemperature/shop/delectGood?stockId="+stockId;
			}
		</script>
		<!-- end scripts-->
	</body>
</html>
